package com.sgcc.fj.pmos.e_fj_home.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.sgcc.pmos.nativesdk.R;
import com.sgcc.fj.pmos.common.base.BaseRecyclerAdapter;
import com.sgcc.fj.pmos.e_fj_home.bean.InformationDisclosureBean;

public class InforDiscloFirstStepAdapter extends BaseRecyclerAdapter<InformationDisclosureBean.DataBean> {

    private int selectPosition = 0;

    /**
     * 选择
     */
    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
        notifyDataSetChanged();
    }

    @Override
    public RecyclerView.ViewHolder onCreate(ViewGroup parent, int viewType) {
        return new InforDiscloFirstStepHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_information_disclosure_first, parent, false));
    }

    @Override
    public void onBind(RecyclerView.ViewHolder viewHolder, int position, InformationDisclosureBean.DataBean data) {
        InforDiscloFirstStepHolder holder = (InforDiscloFirstStepHolder) viewHolder;

        holder.mTvFirstName.setText(data.getLabel());

        if (selectPosition == position) {
            holder.mViewE6.setVisibility(View.GONE);
            holder.mView09.setVisibility(View.VISIBLE);
        } else {
            holder.mViewE6.setVisibility(View.VISIBLE);
            holder.mView09.setVisibility(View.GONE);
        }
    }


    class InforDiscloFirstStepHolder extends Holder {

        private TextView mTvFirstName;
        private View mViewE6;
        private View mView09;

        public InforDiscloFirstStepHolder(View itemView) {
            super(itemView);
            mTvFirstName = (TextView) itemView.findViewById(R.id.tv_first_name);
            mViewE6 = (View) itemView.findViewById(R.id.view_e6);
            mView09 = (View) itemView.findViewById(R.id.view_09);
        }
    }
}
